﻿using Basic.HrOperateLogModular.ApiRouteFilter;
using WeDonekRpc.Client.Attr;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Interface;

namespace Basic.HrGatewayModular
{
    public class HrGatewayApiModular : BasicApiModular
    {
        public HrGatewayApiModular () : base("HrApi_Gateway")
        {
        }
        protected override void Load ( IHttpGatewayOption option, IModularConfig config )
        {
            this.AddFilters<OperateLogFilter>();
            config.ApiRouteFormat = "/hr/{controller}/{name}";
            option.IocBuffer.SetDefLifetimeType(( body ) =>
            {
                if ( body.To.FullName.StartsWith("Basic.HrGatewayModular.Interface.") )
                {
                    body.SetLifetimeType(ClassLifetimeType.SingleInstance);
                }
            });
        }
    }
}
